{% load static %}
<!DOCTYPE html>
<html style="overflow-x:auto;overflow-y:auto;">
<head>
	<title>Role Manage</title>
	
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="author" content="http://www.jeeplus.org/"/>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=9,IE=10" />
<meta http-equiv="Expires" content="0">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Cache-Control" content="no-store">
<script>var d = "";</script>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
{% include 'base.html' %}
<script type="text/javascript">

    $(document).ready(function(){
        $('input.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-blue',
            radioClass: 'iradio_square-blue',
            increaseArea: '20%' // optional
        });
    });


</script>

	
	
	<meta name="decorator" content="ani"/>
	<link href="{% static '/ani/static/plugin/jstree/style.css' %}" rel="stylesheet" type="text/css"/>
<script src="{% static '/ani/static/plugin/jstree/jstree.min.js' %}" type="text/javascript"></script>

	<script type="text/javascript">
        function save() {
            var isValidate = jp.validateForm('#inputForm');//校验表单
            if(!isValidate){
                return false;
            }else{
                jp.loading();
                jp.post("/system/role/{{method}}/",$('#inputForm').serialize(),function(data){
                    if(data.success){
                        jp.getParent().refresh();
                        var dialogIndex = parent.layer.getFrameIndex(window.name); // 获取窗口索引
                        parent.layer.close(dialogIndex);
                        jp.success(data.msg)

                    }else{
                        jp.error(data.msg);
                    }
                })
            }

        }
		
		$(document).ready(function(){
			$("#name").focus();
			$("#inputForm").validate({
				rules: {
					name: {remote: "/system/role/check/name/?oldName=" + encodeURIComponent("{{role.name|default_if_none:''}}")}//设置了远程验证，在初始化时必须预先调用一次。
					
				},
				messages: {
					name: {remote: "Role name exists!"}
				}
			});
		});

	</script>

</head>
<body id="" class="bg-white"  style="">
	
	<form id="inputForm" class="form-horizontal" action="/system/role/{{method}}/" method="post" autocomplete="off">
		{% csrf_token %}
		
		<input id="id" name="id" type="hidden" value="{{role.id|default_if_none:''}}"/>
		<table class="table table-bordered  table-condensed dataTables-example dataTable no-footer">
		   <tbody>
		      
		      <tr>
		         <td class="width-15 active"><label class="pull-right"><font color="red">*</font>Role Name:</label></td>
		         <td class="width-35"><input id="oldname" name="oldname" type="hidden" value="{{role.name|default_if_none:''}}">
					<input id="name" name="name" class="form-control required" type="text" value="{{role.name|default_if_none:''}}" maxlength="50"/></td>
		         <td  class="width-15 active" class="active"><label class="pull-right">Useable:</label></td>
		            <td class="width-35"><select id="useable" name="useable" class="form-control ">
		         					<option value="1" {% ifequal  role.useable 1 %}selected {% endifequal %}>Yes</option><option value="0" {% ifequal  role.useable 0 %}selected {% endifequal %}>No</option>
		         					</select>
		         					</td>
		         
		      </tr>
		      <tr>
				 <td class="width-15 active"><label class="pull-right">Remarks:</label></td>
		         <td class="width-35"><textarea id="remarks" name="remarks" maxlength="200" class="form-control " rows="3">{{role.remarks|default_if_none:''}}</textarea></td>
		          <td class="width-15 active"></td>
		         <td class="width-35"></td>
		      </tr>
			</tbody>
			</table>
			<input id="menuIds" name="menuIds" type="hidden" value=""/>
	</form>

</body>
</html>